package com.lhj.springboot.web.config;

import com.lhj.springboot.web.handler.UserHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.function.*;

import static org.springframework.web.servlet.function.RequestPredicates.accept;

/**
 * @Description
 * @Author lhj
 * @Date 2024/6/19 22:19
 */
@Configuration(proxyBeanMethods = false)
public class UserRoutingConfiguration {
    
    private static final RequestPredicate ACCEPT_JSON = accept(MediaType.APPLICATION_JSON);
    
    @Bean
    public RouterFunction<ServerResponse> routerFunction(UserHandler userHandler) {
        return RouterFunctions.route()
                .GET("/user/{id}", RequestPredicates.accept(MediaType.ALL), userHandler::getUser)
                .build();
                
    }
    
}
